<?php
/*
 * Create by Indonesian Brain Solutions
 * E-mail : cs@mesinit.com
 * Programmer : sony@sonywibisono.com
 */
if (!defined('__BACKEND__'))
    die("you cannot directly access this page");

include("class/AppModules.php");

_showMenuHeader();

function add(){
    
}
function edit(){
    global $db,$id;
    $sql="select * from";
    $row=$db->fetch_row($sql);
    
}
function add_process(){
    global $db,$id;
    
}
function edit_process(){
    global $db,$id;
    
}
function delete_process(){
    global $db,$id;
    
}
function __default(){
    global $db,$page,$mod,$file,$sortby,$sortorder;
    $sql="select a.*,b.role_name from app_users a,app_roles b 
          where a.app_role_id=b.id order by a.user_name";
    $result=$db->query($sql);
    
    echo "<h2>User List</h2>
        <table width='100%' cellpadding='4' cellspacing='0'><tr><th>Id</th>
        <th>User Name</th><th>Full Name</th><th>Email</th>
        <th>Mobile</th><th>Locked</th><th>Active</th>
        <th>Sms Alert Receiver</th>
        <th>App Role</th>
        <th>Action</th></tr>";
    while($row=$db->fetch_array($result)){
        extract($row);
        echo "<tr><td>$id</td><td>$user_name</td><td>$full_name</td><td>$email</td>
            <td>$mobile</td><td align=center>$locked</td><td align=center>$active</td>
                <td align=center>$sms_alert_receiver</td><td>$role_name</td>
                    <td><a href=\"?mod=$mod&file=$file&action=edit&id=$id\">
        <img class=\"icon_small\" src='images/edit.png' title='Edit'/></a>
        <a href=\"?mod=$mod&file=$file&action=delete&id=$id\"><img class=\"icon_small\" 
            src='images/delete.png' title='Delete'/></a></td></tr>";
    }
    echo "</table>";
}

global $action,$user_id,$login_status,$is_admin,$mod;
switch($action){
    case 'add':
        add();
        break;
    case 'edit':
        edit();
        break;
    case 'add_process':
        add_process();
        break;
    case 'edit_process':
        edit_process();
        break;
    case 'delete':
        delete_process();
        break;
    default:
        __default();
}
?>